using System;

namespace Demo
{
    public class CreditCard
    {
        private int month;
        public int Month
        {
            get { return month; }
            set 
            {
                if (value < 1 || value > 12) 
                    throw new ArgumentOutOfRangeException("Invalid month");

                month = value;
            }
        }

        private int year;
        public int Year
        {
            get { return year; }
            set
            {
                if (value < 0)
                    throw new ArgumentOutOfRangeException("Invalid year");

                year = value;
            }
        }

        private string name;
        public string Name
        {
            get { return name; }
            set
            {
                if (value.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Length < 2)
                    throw new ArgumentException("Name should have at least two words");
                name = value;
            }
        }

        public string Number { get; set; }

        public string CVV { get; set; }
    }
}